Skip to content

stream: reject closed only after sink abort settles - #65727

Open
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65726
Open

stream: reject closed only after sink abort settles#65727
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65726

Conversation

@lazerg

@lazerg lazerg commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The writer's closed promise is materialized lazily, and the lazy derivation maps a stream in the 'errored' state straight to an already rejected promise. WritableStreamFinishErroring sets that state before it runs the sink's abort(), so a closed promise first observed inside that window comes back rejected while the sink is still tearing down. The spec only rejects it from WritableStreamRejectCloseAndClosedPromiseIfNeeded, in the reaction to the abort algorithm.

The closed records are now materialized as pending right before the abort algorithm runs, so the existing settle sites reject them at the point the spec does.

Fixes: #65726

Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. web streams Issues and PRs related to the Web Streams API. labels Sep 1, 2026
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 1, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2026
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.07%. Comparing base (f9ab994) to head (b802059).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65727      +/-   ##
==========================================
- Coverage   90.07%   90.07%   -0.01%     
==========================================
  Files         754      754              
  Lines      256395   256402       +7     
  Branches    48494    48508      +14     
==========================================
+ Hits       230947   230951       +4     
- Misses      16563    16576      +13     
+ Partials     8885     8875      -10     
Files with missing lines Coverage Δ
lib/internal/webstreams/writablestream.js 93.51% <100.00%> (+0.03%) ⬆️

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run. web streams Issues and PRs related to the Web Streams API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webstreams: writer.closed settles before sink abort() completes when first observed during erroring

3 participants